{template 'public/header'}

{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_tcwq/template/public/ygcsslist.css">

<ul class="nav nav-tabs">
  <span class="ygxian"></span>
  <div class="ygdangq">当前位置:</div>
 <li   {if $type=='wait'} class="active" {/if}><a href="{php echo $this->createWebUrl('renwulist',array('type'=>wait,'state'=>2));}">进行中</a></li>
 <li   {if $type=='ok'} class="active" {/if}><a href="{php echo $this->createWebUrl('renwulist',array('type'=>ok,'state'=>3));}">待付款</a></li>
 <li   {if $type=='no'} class="active" {/if}><a href="{php echo $this->createWebUrl('renwulist',array('type'=>no,'state'=>4));}">已完成</a></li>
 <li   {if $type=='n'} class="active" {/if}><a href="{php echo $this->createWebUrl('renwulist',array('type'=>n,'state'=>5));}">撤回</a></li>
 <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('renwulist',array('type'=>all));}">全部任务</a></li>
</ul>
<div class="row ygrow">
    <div class="col-lg-12">
        <!--
    <div class="panel panel-default ygbody">
        <div class="panel-body">
            <p class="yangshi">跳转任务页面地址,id在任务列表中获取:&nbsp;&nbsp;<a>../infodetial/infodetial?id=1</a></p>
        </div>
    </div>-->
        <form action="" method="get" class="col-md-3">
          <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="renwulist" />
            <div class="input-group" style="width: 200px">
                <input type="text" name="keywords"  class="form-control" value="{$_GPC['keywords']}" placeholder="请输入任务联系人名称/电话/内容">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
           <input type="hidden" name="type" value="all"/>
        </form>
         <form action="" method="get" class="col-md-3">
          <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="renwulist" />
            <div class="input-group" style="width: 100px">
                {php echo tpl_form_field_daterange('time',$_GPC['time']);}
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit2" value="查找"/>
                     <input type="hidden" name="token" value="{$_W['token']}"/>
                       <input type="hidden" name="type" value="all"/>
                </span>
            </div><!-- /input-group -->
        </form>
        <form action="" method="get" class="col-md-3">
          <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="renwulist" />
            <div class="input-group" style="width: 100px">
               <div class="col-md-3 yg5_key">
                <div></div>
                <select class="input-group" style="width: 200px" name="type_id">  
                <option value="">不限</option>
                     {loop $tztype $row}  
                     {if $_GPC['type_id']==$row['id']}                            
                    <option value="{$row['id']}" selected>{$row['type_name']}</option>
                    {else}
                    <option value="{$row['id']}">{$row['type_name']}</option>
                    {/if}
                       {/loop}
                </select>
                </div>
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit2" value="查找"/>
                     <input type="hidden" name="token" value="{$_W['token']}"/>
                       <input type="hidden" name="type" value="all"/>
                </span>
            </div><!-- /input-group -->
        </form>
        <!--<form action="" method="POST" class="col-md-2">
            <div class="input-group" style="width: 100px">
              <input type="hidden" name="top" value="1"/>
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit2" value="置顶搜索"/>
                     <input type="hidden" name="token" value="{$_W['token']}"/>
                </span>
            </div>&lt;!&ndash; /input-group &ndash;&gt;
        </form>-->
        
        <input type="hidden" name="token" value="{$_W['token']}"/>
    </div><!-- /.col-lg-6 -->
</div>  
<div class="main">
    <!--
  <div class="panel panel-default">
        <div class="panel-body ygbtn">
             <div class="btn ygshouqian2" id="allselect">批量删除</div>
            <div class="btn ygyouhui2" id="allpass">批量通过</div>
             <div class="btn storegrey2" id="allrefuse">批量拒绝</div>
             <div class="btn storegreen" id="allshuax">批量刷新 </div>
        </div>
    </div>-->
    <div class="panel panel-default">
        <div class="panel-heading">
            任务管理
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                       <!--<th class="store_td1 col-md-1" style="text-align: center;">
	                      <input type="checkbox" class="allcheck" />
	                      <span class="store_inp">全选</span>                      
	                  </th>-->
                        <td class="store_td1 col-md-1">任务id</td>
                       <td class="col-md-1">所属城市</td>
                          <td class="col-md-1">发布时间</td>
                        <td class="col-md-1">发布人</td>
                        <td class="col-md-1">发布人电话</td>
                         <td class="col-md-1">任务简介</td>
                      <!--   <td class="col-md-1">是否热门</td> -->
                        <td class="col-md-1">是否置顶</td>
                        <td class="col-md-1">赏金</td>

                       <!--  <td class="col-md-1">置顶期限</td>-->
                          
                        <td class="col-md-1">状态</td>
                        <td class="col-md-2">操作</td>
                    </tr>
                    {loop $list $key $item}
                    <tr class="yg5_tr2">
                       <!--<td>
	                      <input type="checkbox" name="test" value="{$item['id']}">
	                     </td>-->
                        <td>{$item['id']}</td>
                        <td>{$item['cityname']}</td>
                        <td>{php echo date("Y-m-d H:i:s",$item['time'])}</td>
                        <td>{$item['user_name']}</td>
                        <td>{$item['user_tel']}</td>
                         <td>{php echo substr($item['details'],0,100)}</td>

                       <!--  <td>{if $item['hot']==1}<span class="label label-info">是</span>{else}否{/if}</td> -->
                        <td>{if $item['top']==1}<span class="label storeblue">是</span>{else}
                        <span class="label storegrey">否</span>
                        {/if}</td>
                        <td>{$item['money_clf']}</td>
                         <!-- <td>{if $item['dq_time']}{php echo date("Y-m-d",$item['dq_time'])}{/if}</td>-->
                            
                          
                        {if $item['tatus']==1}
                        <td>
                            <span class="label storered">待领取</span>
                            {if $item['hb_money']>0}<span class="label storered">红包</span>{/if}
                        </td >
                        {elseif $item['tatus']==2}
                        <td >
                            <span class="label storeblue">正在进行</span>
                            {if $item['hb_money']>0}<span class="label storered">红包</span>{/if}
                        </td>
                        {elseif $item['tatus']==3}
                        <td>
                           <span class="label storegrey">待付款</span>
                           {if $item['hb_money']>0}<span class="label storered">红包</span>{/if}
                       </td>
                        {elseif $item['tatus']==4}
                        <td>
                            <span class="label storegrey">已完成</span>
                            {if $item['hb_money']>0}<span class="label storered">红包</span>{/if}
                        </td>
                        {elseif $item['tatus']==5}
                        <td>
                            <span class="label storegrey">已撤回</span>
                            {if $item['hb_money']>0}<span class="label storered">红包</span>{/if}
                        </td>
                       {/if} 
                       <td>
                          {if $item['state']==1}
                           <a href="{php echo $this->createWebUrl('information',array('op'=>'tg','id'=>$item['id'],'page'=>$_GPC['page']));}"><button class="btn ygyouhui2 btn-xs">通过</button></a>
                           <a href="{php echo $this->createWebUrl('information',array('op'=>'jj','id'=>$item['id']));}"><button class="btn ygshouqian2 btn-xs">拒绝</button></a>
                           {/if}
                           {php $user=pdo_get('zhtc_user',array('id'=>$item['user_id']));}
                           {if $user['state']==1}
                      <a href="" data-toggle="modal" data-target="#myModala{$item['user_id']}"><button class="btn storegrey2 btn-xs">拉黑用户</button></a>
                      {elseif $user['state']==2}
                      <a href="" data-toggle="modal" data-target="#myModalb{$item['user_id']}"><button class="btn storegrey2 btn-xs">取消拉黑</button></a>
                      {/if}
                         <!-- <a href="{php echo $this->createWebUrl('informationinfo',array('id'=>$item['id']));}" class="storespan btn btn-xs">
                              <span class="fa fa-pencil"></span>
                              <span class="bianji">编辑
                                  <span class="arrowdown"></span>
                              </span>                            
                          </a>-->
                         <!-- <a href="" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                              <span class="fa fa-trash-o"></span>
                              <span class="bianji">删除
                                  <span class="arrowdown"></span>
                              </span>
                          </a>-->
                           <!-- <a href="{php echo $this->createWebUrl('informationinfo',array('id'=>$item['id']));}"><button class="btn btn-success btn-xs">查看</button></a>
                           
                           <button type="button" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">删</button> -->
                       </td>

                   </tr>
                   <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('renwufenlei', array('op' => 'delete', 'id' => $item['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="myModala{$item['user_id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定要拉黑么？
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('renwulist', array('op' => 'defriend', 'id' => $item['user_id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="myModalb{$item['user_id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定要取消拉黑么？
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('information', array('op' => 'relieve', 'id' => $item['user_id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            {/loop}
            {if empty($list)}
            <tr class="yg5_tr2">
            <td colspan="11">
                  暂无任务信息
              </td>
          </tr>
          {/if}
      </table>
  </div>
</div>
</div>
</div>
<div class="text-right we7-margin-top">
   {$pager}
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-22").show();
        $("#yframe-22").addClass("wyactive");
    	// ———————————————批量删除———————————————
        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的任务!');
                return false;
            }else if(confirm("确认要删除此任务?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=alldeleteinfo&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })               
            }
        });

        // ———————————————批量通过———————————————
        $("#allpass").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要通过的任务!');
                return false;
            }else if(confirm("确认要通过此任务?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=AdoptInfo&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })               
            }
        });


         // ———————————————批量刷新———————————————
        $("#allshuax").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要刷新的任务!');
                return false;
            }else if(confirm("确认要刷新此任务?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=Refresh&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })               
            }
        });

        // ———————————————批量拒绝———————————————
        $("#allrefuse").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要拒绝的任务!');
                return false;
            }else if(confirm("确认要拒绝此任务?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=RejectInfo&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })               
            }
        });

        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
        
    })
</script>
